package com.karst.essentials.chapter03
{
	import flash.events.Event;
	
	import org.papervision3d.objects.primitives.PaperPlane;
	import org.papervision3d.view.BasicView;
	
	internal class PaperPlaneExample extends BasicView
	{
		public function PaperPlaneExample()
		{
			super() ;
			createView() ;
			startRendering() ;
		}

		private var paperPlane : PaperPlane = null ;
		private function createView() : void
		{
			if( paperPlane == null )
				paperPlane = new PaperPlane( null, 3 ) ;
			scene.addChild( paperPlane ) ;
			paperPlane.material.doubleSided = true ;
			trace( paperPlane.boundingBox()["size"] ) ;
		}
		
		override protected function onRenderTick(event:Event=null):void
		{
			super.onRenderTick() ;
			if( paperPlane )
			{
				paperPlane.localRotationY++ ;
				paperPlane.localRotationZ += 2 ;
			}
		}
	}
}